//
//  DetailWebViewController.m
//  livingDesign
//
//  Created by dlios on 15-1-30.
//  Copyright (c) 2015年 怡居. All rights reserved.
//

#import "DetailWebViewController.h"

@interface DetailWebViewController ()<UIWebViewDelegate>
@property (nonatomic, retain) UIWebView *webView;

@end

@implementation DetailWebViewController
- (void)dealloc
{
    [_webView release];
    [_str release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
#pragma 创建webView
    self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
    self.webView.backgroundColor = [UIColor redColor];
    self.webView.delegate = self;
    
    // 视图加载
    [self.view addSubview:self.webView];
    
    // 字符串从'|'开始截取
    NSString *ran = [NSString stringWithString:[self.str substringFromIndex:[self.str rangeOfString:@"|"].location]];
    // 字符串@"|"替换成@""空
    NSString *strr = [ran stringByReplacingOccurrencesOfString:@"|" withString:@""];
    NSLog(@"%@", ran);
    NSLog(@"%@", strr);
    // 网址字符
    // 网址URL
    NSURL *url = [NSURL URLWithString:strr];
    //
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60];
    
    // 请求页面
    [self.webView loadRequest:urlRequest];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
